package org.wxl.domain.vo;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.wxl.domain.userEntity;

import java.util.Collection;
import java.util.List;

@Data
@NoArgsConstructor
public class LoginUser implements UserDetails {
    private userEntity userEntity;

    public LoginUser(userEntity userEntity) {
        this.userEntity = userEntity;
    }
    //权限信息
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return userEntity.getPassword();
    }

    @Override
    public String getUsername() {
        return userEntity.getUserName();
    }
// 账户是否过期
    @Override
    public boolean isAccountNonExpired() {
        return true;
    }
// 账户是否被锁定
    @Override
    public boolean isAccountNonLocked() {
        return true;
    }
// 密码是否过期
    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }
// 账户是否可用
    @Override
    public boolean isEnabled() {
        return true;
    }
}
